<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 说明：组合上面的构造函数与原型继承的功能；
   缺点：call()方法已经拿到父类所有的属性 ，后面再使用原型时也会有父类所有属性；  -->
    <script>

        function Parent3() {
            this.name = 'parent3'
            this.arr = [1, 2, 3]
        }
        Parent3.prototype.say = function () {
            console.log(this.name)
        }
        function Child3() {
            Parent3.call(this)
            this.type = 'child3'
        }
        Child3.prototype = new Parent3()

        let child3_1 = new Child3()
        let child3_2 = new Child3()

        child3_1.arr.push(4)
        console.log(child3_1.arr, child3_2.arr) //  [1, 2, 3, 4]  [1, 2, 3]
    // 缺点是 Parent3执行了两次,child3中有重复属性
    </script>

</body>

</html>